package com.itheima.controllor;


import com.itheima.domain.Student;
import com.itheima.service.imp.StudentServiceImpl;
import org.junit.Test;

import java.util.Date;
import java.util.List;

public class StudentControllor {
    public static void main(String[] args) {
        System.out.println("123132");
        System.out.println("123132");
        System.out.println("123132");
        System.out.println("123132");
        System.out.println("123132");
    }
   private  static StudentServiceImpl studentService=new StudentServiceImpl();
    @Test
   public void finAll(){
       List<Student> list = studentService.findAll();
       list.forEach(student-> System.out.println(student));
    }
    @Test
    public void findbyid(){
       Student student = studentService.findById(3);
        System.out.println("student = " + student);
    }
    @Test
    public void insert(){
        Student student = new Student(null, "toh", 22, "2020-01-11");
        int save = studentService.save(student);
        System.out.println("save = " + save);
    }
    @Test
    public void update(){
        Student student = new Student(13, "tom", 26, "2019-01-11");
        int i = studentService.update(student);
        System.out.println(i>0?"修改成功":"修改失败");
    }
    @Test
    public void delete(){
        int i = studentService.delete(13);
        System.out.println(i>0?"删除成功":"删除失败");
    }
}
